package org.zjvis.datascience.service.mapper;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import org.zjvis.datascience.common.dto.DatasetDTO;
import org.zjvis.datascience.common.dto.dataset.DatasetWithCategoryDTO;

import java.util.List;

/**
 * @description 数据集信息表，数据集Mapper
 * @date 2021-10-19
 */
@Component
public interface DatasetMapper {


    String queryTableNameById(Long datasetId);

    DatasetDTO queryByTableName(String tableName);

    int delete(DatasetDTO datasetDTO);

    List<DatasetDTO> queryByCategoryId(Long categoryId);

    DatasetDTO queryById(Long datasetId);

    int update(DatasetDTO datasetDTO);

    List<DatasetDTO> queryByProjectId(Long projectId);

    Long save(DatasetDTO dataset);

    int checkAuth(@Param("id") long id, @Param("userId") long userId);

    DatasetDTO selectOne(DatasetDTO datasetDTO);

    List<DatasetDTO> queryByUserId(Long userId);

    List<DatasetWithCategoryDTO> queryDetailByUserId(Long userId);

    List<DatasetDTO> getAllTableDataSourceNeedScheduled();

    List<DatasetDTO> getAllUrlStatsOn();

    int updateIncrementalConfig(DatasetDTO datasetDTO);

    int countByCategoryIdAndDatasetName(@Param("categoryId") Long categoryId,
                                        @Param("datasetName") String datasetName);

    DatasetDTO queryByCategoryIdAndDatasetName(@Param("categoryId") Long categoryId,
                                               @Param("datasetName") String datasetName);

    List<String> selectLikeDataName(@Param("datasetName") String datasetName);

    List<DatasetDTO> getByproject(Long projectId);

    DatasetDTO queryByDatasetNameAndUser(String datasetName,Long UserId,Long categoryId);

    DatasetDTO queryByUserAndName(String datasetName,Long UserId);

    int deleteById(Long datasetId);

    int updateGraphItem(@Param("id") Long datasetId, @Param("updateName") String updateName, @Param("dataConfig") String dataConfig);
}
